/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;


/**
 * @author FFK
 */
public class Main extends MIDlet {

    private Display display;
    private static Main self;
    private TouchGameView touchGameView;
    private Game game;
    public Setingsdetail settings;
    public Hightscoredetail hightscore;
    public hight_score hight_score;
    private Menu menu;
     public static Main getInstance() {
        return self;

    }
    public void startApp() {
        

        if(display == null) {
            display = Display.getDisplay(this);
            self = this;
            Logo logo=new Logo();
            display.setCurrent(logo);
            // can show 1 form logo nhom truoc
            new Thread() {
                public void run() {
                    
                   try {
                        sleep(1000);
                    }catch(InterruptedException e) {
                        
                    }
                    
                        menu = new Menu();
                        settings = new Setingsdetail();
                       hightscore = new Hightscoredetail(display,menu);
                       hight_score = new hight_score(display, menu);
                               
                       game=new Game();
                      /* GestureInteractiveZone giz = new GestureInteractiveZone(GestureInteractiveZone.GESTURE_ALL);
                    touchGameView = new TouchGameView();
                 
                    GestureRegistrationManager.register(touchGameView, giz);
                    GestureRegistrationManager.setListener(touchGameView, touchGameView);
                   */
                    display.setCurrent(menu);
                    
                    try {
                        join();
                    }catch(InterruptedException e) {
                        
                    }
                }
            }.start();
        }
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }

    public void SStart() {
        //display.setCurrent(touchGameView);
        display.setCurrent(game);
    }
    public void SMenu() {
        display.setCurrent(menu);
    }

    void SSetings() {
        display.setCurrent(settings);
    }
    
    public Game getGame() {
     //   return touchGameView;
        return game;
    }

    public void SHightscore() {
        //display.setCurrent(hightscore);
        hightscore.showhightscore();
        //hight_score.showhightscore();
        
//        display.setCurrent(hightscore);
    }
     public void exit() {
        destroyApp(false);
        notifyDestroyed();
    }

}
